#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"

UPTIME=`cat /proc/uptime |awk -F. '{print $1}'`
if [ "$UPTIME" -lt "900" ]
then
   echo "OK;" > /usr/local/zombie.log
fi

Stat=`cat /usr/local/zombie.log |awk -F ';' '{print $1}'`
if [ "$Stat" == "OK" ]
then
    echo "there is no zombie, OK"
    exit $OK
fi

if [ "$Stat" == "ERROR" ]
then
   Reason=`cat /usr/local/zombie.log |awk -F ';' '{print $2}'`
   echo $Reason
   exit $CRITICAL
fi


if [ "$Stat" == "WARNING" ]
then
   Reason=`cat /usr/local/zombie.log |awk -F ';' '{print $2}'`
   echo $Reason
   exit $WARN
else
   echo "check_zombile status is OK"
   exit $OK
fi

